﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Geometry
{
    /// <summary>
    /// Circle Representation
    /// </summary>
    public class Circle : Geometry
    {
        /// <summary>
        /// Center of the circle
        /// </summary>
        public Point center { get; private set; }
        /// <summary>
        /// Radius of the circle
        /// </summary>
        public double radius { get; private set; }

        public bool clockwise { get; private set; }
        /// <summary>
        /// Default Constructor
        /// </summary>
        public Circle()
        {
            center = new Point();
            radius = 0;
            clockwise = false;
        }

        /// <summary>
        /// Parameter Constructor
        /// </summary>
        /// <param name="lx">X Coordinate of the point</param>
        /// <param name="ly">Y Coordinate of the point</param>
        /// <param name="lradius">Circle Radius</param>
        public Circle(Point lcenter, double lradius, bool lcloackwise = false)
        {
            center = new Point(lcenter);
            radius = lradius;
            clockwise = lcloackwise;
        }

        /// <summary>
        /// Copy Constructor
        /// </summary>
        /// <param name="lcircle"></param>
        public Circle(Circle lcircle)
        {
            center = new Point(lcircle.center);
            radius = lcircle.radius;
            clockwise = lcircle.clockwise;
        }

        /// <summary>
        /// Chech if the point solves the circle equation (is on the perimeter)
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        /// <returns>True if is on the perimeter</returns>
        public static bool IsOnCircle(Circle c, Point p)
        {
            double check_radius = Math.Pow((p.x - c.center.x), 2) + Math.Pow((p.y - c.center.y), 2);
            check_radius = Math.Sqrt(check_radius);
            if (check_radius == c.radius) return true;
            return false;
        }
    }
}
